#lang racket

(define (make-monitored f)
  (let ((count 0))
    (define (dispatch input)
    (cond ((eq? input 'how-many-calls?)
           count)
          ((eq? input 'reset-count)
           (set! count 0))
          (else (set! count (+ count 1))
                (f input))))
    dispatch))

(define s (make-monitored sqrt))

(s 100)

(s 'how-many-calls?)

(s 25)

(s 'how-many-calls?)

(s 'reset-count)

(s 'how-many-calls?)